function getXMLObject() {
    var xmlHttp = false;
    try {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
        try {
            xmlHttp = new XMLHttpRequest();
        } catch (e) {
            try {
                xmlHttp = new ActiveXObject("MSXML2.XMLHTTP");
            } catch (e) {
                xmlHttp = false;
            }
        }
    }
    return xmlHttp;
}

function getjsonEfromurl(xmlhttp, url) {
    var json;
    xmlhttp.open("POST", url, false); //false para que sea sincrono
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4) {
            if (xmlhttp.status == 200) {
                var m_res = xmlhttp.responseText;
//                m_res = m_res.substring(0, m_res.indexOf("}") + 1);
                json = m_res;
                try {
                    json = JSON.parse(m_res);
                } catch (e) {
                    json = undefined;
                }
            }
        }
    }
    xmlhttp.send(null);
    return json;
}

function getjsonfromurl(xmlhttp, url) {
    var json;
    xmlhttp.open("POST", url, false); //false para que sea sincrono

    var t = navigator.userAgent;
    var t2 = t.indexOf("F");
    if (t2 > -1) {
        t2 = t.substring(t2, t.length);
        t2 = t2.replace("Firefox/", "");
    }
    else
        t2 = "";


    if (t2.indexOf("3") > -1) {
        xmlhttp.onload = xmlhttp.onerror = xmlhttp.onabort = function () {
            var m_res = xmlhttp.responseText;
            try {
                json = eval(m_res);
            } catch (e) {
                try {
                    json = JSON.parse(m_res);
                } catch (e2) {
                    json = "[E]" + m_res;
                }
            }
        };

    } else {
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4) {
                if (xmlhttp.status == 200) {
                    var m_res = xmlhttp.responseText;
                    try {
                        json = eval(m_res);
                    } catch (e) {
                        try {
                            json = JSON.parse(m_res);
                        } catch (e2) {
                            json = "[E]" + m_res;
                        }
                    }
                }
            }
        }
    }
    xmlhttp.send(null);
    return json;
}

